﻿using System;
using System.Collections.Generic;
using SocialKit.LightRest;
using SocialKit.LightRest.OAuth;
using SocialKit.SinaWeibo.Api.Extensions;

namespace SocialKit.SinaWeibo.Api
{
    public partial class SinaWeiboClient
    {
        //public event EventHandler<ApiResponseEventArgs<IEnumerable<Models.Status>>> GetPublicTimelineAsyncCompleted;

        /// <summary>
        /// 获取最新更新的公共微博消息。
        /// </summary>
        /// <returns></returns>
        public IEnumerable<Models.Status> GetPublicTimeline()
        {
            var response = this.RestApiClient.Get("/statuses/public_timeline.json?source=" + this.OAuthConsumer.Key);

            return response.Ensure().ReadJsonContent<IEnumerable<Models.Status>>();
        }

        public IEnumerable<Models.Status> GetFriendsTimeline(AccessToken token)
        {
            var response = this.RestApiClient.Get("/statuses/friends_timeline.json?source=" + this.OAuthConsumer.Key);

            return response.Ensure().ReadJsonContent<IEnumerable<Models.Status>>();
        }
    }
}